home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / GXCHAR.H < prev    next >
C/C++ Source or Header  |  1992-03-21  |  5KB  |  112 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gxchar.h */
  21. /* Internal character definition for Ghostscript library */
  22. /* Requires gsmatrix.h, gxfixed.h, gzdevice.h */
  23. #include "gschar.h"
  24.  
  25. /* An entry for a (font,matrix) pair in the character cache. */
  26. /* Either font == 0 and UniqueID != -1, or font != 0 and UniqueID == -1. */
  27. typedef struct cached_fm_pair_s cached_fm_pair;
  28. struct cached_fm_pair_s {
  29.     struct gs_font_s *font;        /* base font */
  30.     long UniqueID;            /* font UniqueID */
  31.     char * /* void * */ encoding;    /* encoding vector (opaque) */
  32.     float mxx, mxy, myx, myy;    /* transformation */
  33.     int num_chars;            /* # of cached chars with this */
  34.                     /* f/m pair */
  35. };
  36. /* If font == 0 and UniqueID == -1, this is a free entry. */
  37. #define fm_pair_is_free(pair) ((pair)->font == 0 && (pair)->UniqueID == -1)
  38. #define fm_pair_set_free(pair) ((pair)->font = 0, (pair)->UniqueID = -1)
  39.  
  40. /* The type of cached characters is opaque. */
  41. typedef struct cached_char_s cached_char;
  42. extern const uint cached_char_sizeof;
  43.  
  44. /* An enumeration object for string display. */
  45. typedef enum {
  46.     sws_none,
  47.     sws_cache,            /* setcachedevice */
  48.     sws_no_cache            /* setcharwidth */
  49. } show_width_status;
  50. struct gs_show_enum_s {
  51.     /* Following are set at creation time */
  52.     gs_state *pgs;
  53.     int level;            /* save the level of pgs */
  54.     byte *str;            /* char may be signed! */
  55.     uint size;
  56.     float wcx, wcy;            /* for widthshow */
  57.     char_code wchr;            /* ditto */
  58.     float ax, ay;            /* for ashow */
  59.     int add;            /* true if a[width]show */
  60.     int do_kern;            /* true if kshow */
  61.     int slow_show;            /* [a][width]show or kshow */
  62.     int charpath_flag;        /* 0 for show, 1 for false */
  63.                     /* charpath, 2 for true charpath */
  64.     int stringwidth_flag;        /* 0 for show/charpath, */
  65.                     /* 1 for stringwidth */
  66.     int can_cache;            /* true if can cache chars */
  67.     int cxmin, cymin, cxmax, cymax;    /* int version of quick-check */
  68.                     /* clipping box */
  69.     int is_composite;        /* true if composite font */
  70.     int ftx, fty;            /* transformed font translation */
  71.     /* Following are set at most once */
  72.     gx_device_memory dev_cache_info;
  73.     device dev_cache_dev;
  74.     int dev_cache_set;
  75.     /* Following are updated dynamically */
  76.     uint index;            /* index within string */
  77.     gs_fixed_point wxy;        /* for current char in device coords */
  78.     cached_char *cc;        /* being accumulated */
  79.     gs_point width;            /* total width of string, set at end */
  80.     show_width_status width_status;
  81.     gs_fixed_point metrics_sb, metrics_width;    /* width and side */
  82.                     /* bearing from metrics, in */
  83.                     /* *character* coordinates */
  84.                     /* (only used for Type 1 fonts) */
  85.     byte sb_set, width_set;        /* true if metrics set */
  86.                     /* (only used for Type 1 fonts) */
  87.     int color_loaded;        /* true if have done gx_color_render */
  88.     int (*continue_proc)(P1(struct gs_show_enum_s *));    /* continuation procedure */
  89.     /* Following are dynamic, for composite fonts only */
  90. #define max_font_depth 5
  91.     struct gs_font_s *fstack[max_font_depth];
  92.     int fdepth;
  93.     struct gs_font_s *pfont;
  94. };
  95. #define gs_show_enum_s_DEFINED
  96.  
  97. /* Cached character procedures (in gxfont.c) */
  98. #ifndef gs_font_dir_DEFINED
  99. #  define gs_font_dir_DEFINED    
  100. typedef struct gs_font_dir_s gs_font_dir;
  101. #endif
  102. void    gx_char_cache_init(P1(gs_font_dir *));
  103. cached_char *
  104.     gx_alloc_char_bits(P4(gs_font_dir *, gx_device_memory *, ushort, ushort));
  105. void    gx_free_cached_char(P2(gs_font_dir *, cached_char *));
  106. cached_fm_pair *
  107.     gx_lookup_fm_pair(P1(gs_state *));
  108. void    gx_add_cached_char(P4(gs_font_dir *, gx_device_memory *, cached_char *, cached_fm_pair *));
  109. cached_char *
  110.     gx_lookup_cached_char(P3(gs_state *, cached_fm_pair *, char_code));
  111. int    gx_image_cached_char(P2(gs_show_enum *, cached_char *));
  112.